package testing;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;

public class CharaterCoding {
	public static void main(String[] args) throws CharacterCodingException
	{
		CharBuffer charBuff = CharBuffer.wrap("sossa");
		CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
		ByteBuffer b = encoder.encode(charBuff);
		CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder();
		CharBuffer chars = decoder.decode(b);
		char[] chs = chars.array();
		for (int i = 0; i < chs.length; i++)
			System.out.print(chs[i]);
		
	}

}
